from django.shortcuts import render

# Create your views here.
from .models import BannerInfo,NavInfo
from .serializers import BannerInfoSerializer,NavInfoSerializer
from rest_framework.generics import ListAPIView


class BannerInfoListAPIView(ListAPIView):
    queryset = BannerInfo.objects.filter(is_show=True,is_delete=False).order_by('orders')#判断如果is_show=True 并且is_delete=False那么就取出数据
    serializer_class = BannerInfoSerializer

class HeaderNavInfoAPIView(ListAPIView):
    #头部导航栏
    queryset = NavInfo.objects.filter(is_show=True, is_delete=False,
    opt = 1).order_by("orders")
    serializer_class = NavInfoSerializer

class FooterNavInfoAPIView(ListAPIView):
    #脚部导航栏
    queryset = NavInfo.objects.filter(is_show=True, is_delete=False,
    opt = 2).order_by("orders")
    serializer_class = NavInfoSerializer